package Tests.ChessPieces;

import Models.ChessPieceModel;
import Models.Player;
import Models.StandardChessPieceModel;
import Models.StandardPlayer;
import Models.StandardPoint2D;
import java.rmi.RemoteException;

import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import Controllers.BishopController;

public class BishopControllerTest {
	private BishopController bishopController;
	private Player player;

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		
	}

	@Before
	public void setUp() throws Exception {
		bishopController = new BishopController();
		player = new StandardPlayer();
	}

	@Test
	public void testLegalMove() {
		try {
			ChessPieceModel model = new StandardChessPieceModel(player);
			Assert.assertTrue(bishopController.legalMove(new StandardPoint2D(3,3), model));
			Assert.assertTrue(bishopController.legalMove(new StandardPoint2D(-2,-2), model));
			Assert.assertTrue(bishopController.legalMove(new StandardPoint2D(-1,1), model));
			Assert.assertTrue(bishopController.legalMove(new StandardPoint2D(3,-3), model));
			Assert.assertTrue(bishopController.legalMove(new StandardPoint2D(4,-4), model));
			
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@Test
	public void testIlegalMove() {
		try {
			ChessPieceModel model = new StandardChessPieceModel(player);
			Assert.assertFalse(bishopController.legalMove(new StandardPoint2D(1,2), model));
			Assert.assertFalse(bishopController.legalMove(new StandardPoint2D(-1,2), model));
			Assert.assertFalse(bishopController.legalMove(new StandardPoint2D(0,-1), model));
			
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
